﻿using MDT.LifeSewagePlatform.Conmmon;
using MDT.LifeSewagePlatform.InterfaceService;
using MDT.LifeSewagePlatform.Entity;
using MDT.LifeSewagePlatform.IRepository;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MDT.LifeSewagePlatform.Service
{
    public class RoleService:BaseService,IRoleService
    {
        [Autowired]
        private IRoleRepository roleRepository { get; set; }
        public RoleService()
        {
        }
        public async Task<BaseMessage> GetRolesNoAdmin()
        {
            List<RoleEntity> roles = await roleRepository.Where(r=>!r.RoleName.Contains("Admin")).ToListAsync();

            return Ok200("查询成功!",roles);
        }

        public async Task<BaseMessage> GetRoles()
        {
            List<RoleEntity> roles = await roleRepository.GetQuery().ToListAsync();
            return Ok200("查询成功!",roles);
        }
    }
}
